package IC.lir.instructions;
import IC.lir.operands.*;
import IC.lir.*;

/**
 * MoveArray instruction (store):
 * 
 * MoveArray Op1, Op2
 * 
 * Op1: Reg, Immediate
 * Op2: Reg[Reg], Reg[Immediate]
 *
 */
public class MoveToArrayInstr extends MoveArrayInstr {
	private Operand 	source;

	/**
	 * Creates a MoveArray store instruction
	 * @param array The array address
	 * @param index the array index specefier
	 * @param source the destination 
	 */
	public MoveToArrayInstr(Operand source, RegOperand array, Operand index) {
		super(array,index);
		assert(source instanceof RegOperand || source instanceof ImmOperand || source instanceof Label);
		this.source = source;
	}

	/**
	 * @return the destination
	 */
	public Operand getSource() {
		return source;
	}

	@Override
	public <D,U> U accept(Visitor<D,U> v, D context) {
		return v.visit(this,context);
	}
}
